<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 200px;
            display: flex;
            flex-direction: column;
        }
        .input{
            margin: 10px 20px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div>
            <span>title</span><input type="text" class="title input">
        </div>
        <div>
            <img src="" alt="">
            <span>img</span><input type="file" class="img input" value="图片路径">
        </div>
        <div>
            <span>content</span><textarea name="" id="" class="content input"></textarea>
        </div>
    </div>
    <script>
        const urlParams = new URLSearchParams(window.location.search)
        const id = urlParams.get('id')
        const data = JSON.parse(localStorage.getItem("list"))
        let title = document.querySelector('.title')
        let content = document.querySelector('.content')
        let imgsrc = document.querySelector('img')
        let targetArticle
        console.log(id)
        data.forEach(element => {
            if(element.id === id){
                targetArticle = element
            }
        });

        console.log(targetArticle.title)
        console.log(targetArticle.content)
        title.value = targetArticle.title
        content.innerHTML = targetArticle.content
        imgsrc.src = targetArticle.src
    </script>
</body>
</html>